import * as actionTypes from "./constance";
import { getDjRadioDetail, getDjProgram } from "@/services/djRadioDetail";
import { getDjRadioHot } from "@/services/djradio";

const djRadioAction = (res) => ({
  type: actionTypes.DJRADIODETAIL,
  djRadioDetail: res,
});

const djProgramAction = (res) => ({
  type: actionTypes.DJPROGRAM,
  djPrograms: res,
});
const getDjRadioHotAction = (res) => ({
  type: actionTypes.GETDJRADIOHOT,
  DjRadioHotList: res,
});

export const DjRadioDetail = (rid) => {
  return (dispatch) => {
    getDjRadioDetail(rid).then((res) => {
      dispatch(djRadioAction(res));
    });
  };
};

export const djProgram = (rid, limit, offset, asc) => {
  return (dispatch) => {
    getDjProgram(rid, limit, offset, asc).then((res) => {
      dispatch(djProgramAction(res));
    });
  };
};
export const getDjRadioHotList = (cateId, limit, offset) => {
  return (dispatch) => {
    getDjRadioHot(cateId, limit, offset).then((res) => {
      dispatch(getDjRadioHotAction(res));
    });
  };
};
